This query returns a boolean value to indicate whether the Tool palette is open (true) or closed (false).
PGetToolbox isOpen; if (isOpen) PToolbox(false); // close it
Comments or suggestions? Contact Adobe Developer Support